package com.barry.auth.config;

import com.barry.auth.filter.SignInterceptor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class SignConfiguration implements WebMvcConfigurer {

    @Value("${sign.maxTime}")
    private String signMaxTime;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(signInterceptor())
                .addPathPatterns("/**");
    }

    @Bean
    public SignInterceptor signInterceptor() {
        return new SignInterceptor();
    }

}